import { Module } from '@nestjs/common';
//import { AppController } from './app.controller';
import { AppService } from './app.service';

import { SequelizeModule } from '@nestjs/sequelize';
import { User } from './users/users.model';
import { UsersModule } from './users/users.module';


@Module({
  imports: [
    SequelizeModule.forRoot({
      /*dialectOptions: {
        charset: 'utf8mb4',
        supportBigNumbers: true,
        bigNumberStrings: true
      },*/
      dialect: 'postgres', // postgres / mysql
      host: '129.159.47.69',
      port: 19359,
      username: 'postgres',
      password: 'Xiehaijun945',
      database: 'study',
      //models: [User],
      autoLoadModels: true, //自动添加到models
      synchronize: true,
      //设置标准时区
      /*timezone: '+08:00',
      //配置
      dialectOptions: {
        // 时间格式化，返回字符串
        dateStrings: true,
        typeCast(field, next) {
          if (field.type === 'DATETIME') {
            return field.string()
          }
          return next()
        }
      }*/
    }),
    UsersModule
  ],
  //controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
